<template>
  <div>
    <h1 style="color: red">这里是子组件</h1>
    <ul>
      <li v-for="(value, index) in girls" style="list-style: none">
        {{ index }} - {{ value.name }} - {{ value.age }}
        <button @click="noticeGroup(value.name,value.age)">发送消息</button>
      </li>
    </ul>
    <div>接收来自父组件的消息:{{ noticeGirl }}</div>
  </div>
</template>
<script>
  export default {
    name: 'girl-group',
    props: {
      girls: {
        type: Array,
        required: true
      },
      noticeGirl: {
        type: String,
        required: false
      }
    },
    methods: {
      noticeGroup (name, age) {
        this.$emit('introduce',{
          name: name,
          age: age
        })
      }
    }
  }
</script>

<style scoped>

</style>
